<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>最长公共前缀自写</title>
	</head>
	<body>
		<script>
			var arr = ['floor','floowe','floofe'];
			function show(arrays){
				if(arrays.length==0){
                   return '';
				}
				var num=arrays[0];
				for(var array of arrays){
					console.log(array);
					var toast='';
					for(var i=0,j=0;i<num.length&j<array.length;i++,j++){
						if(num[i]!==array[j]){
							break;
						}else{
							toast+=array[j]
						}
					}
					num = toast;
				}
				return num;
			}
			console.log(show(arr));
		</script>
	</body>
</html>
